#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <signal.h>
#include <string.h>
#include "chemnitz_paths.h"


int main (int argc, char **argv)
{
	int infile;
	pid_t pid;
	int e;
	if (argc > 1)
	{
		return 1;
	}
	infile = open (PID_PATH, O_RDONLY);
	if (infile < 0)
	{
		return 1;
	}
	e = read (infile, &pid, sizeof (pid));
	close (infile);
	kill (pid, SIGTERM);
	if (0 == strcmp (argv [0], "chemnitz_restart"))
	{
		execlp ("chemnitzd", "chemnitzd", (char *) 0);
	}
	return 0;
}

